<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    //部门管理
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('dept', function (Blueprint $table) {
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            $table->id();
            $table->string('deptid', 50);
            $table->string('deptnm', 100);
            $table->bigInteger('treeid');
            $table->bigInteger('parentid')->nullable();
            $table->string('leader', 50)->nullable();
            $table->string('leader1', 50)->nullable();
            $table->string('leader2', 50)->nullable();
            $table->integer('isproddept')->nullable();
            $table->string('des', 200)->nullable();
            $table->string('des1', 200)->nullable();
            $table->string('des3', 200)->nullable();
            $table->string('tabnm', 50)->nullable();
            $table->string('modifier', 50)->nullable();
            $table->integer('isdel')->nullable()->default(0);
            $table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
            $table->timestamp('created_at')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('dept');
    }
};
